A stream cipher is a symmetric key cipher where plain text bits are combined with a pseudorandom cipher bit stream (“key stream”), typically by an exclusive- or (“XOR”) operation. In cryptography, a key stream is a stream of random or pseudorandom characters that are combined with a plain text message to produce an encrypted message (“cipher text”). The characters in the key stream can be bits, bytes, numbers, or actual characters like A-Z depending on the usage case. Usually, each character in the key stream is either added, subtracted, or XORed with a character in the plaintext to produce the cipher text using modular arithmetic. The XOR operation is generally defined as a type of logical disjunction on two operands that result in a value of “true” if and only if exactly one of the operands has a value of “true”. Stream ciphers are considered to be one of the strongest types of cipher used in cryptography.
In a stream cipher, the plain text digits are encrypted one at a time, and the transformation of successive digits varies during the encryption. In practice, the digits are typically single bits or bytes. Stream ciphers typically execute at a relatively high speed and have relatively low hardware complexity. Stream ciphers, however, can be susceptible to serious security problems if used incorrectly.